<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
/*background-attachment,设置背景图片是否随着页面滚动
    scroll:默认值，背景图片随着页面滚动
    fixed：背景图片会固定在页面位置，不随页面滚动
    
    当背景图片background-attachment设置为fixed时，背景图片定位永远相对于浏览器窗口*/
    
			body{
			color:white;height:5000px;
			background-image: url(1.jpg);
			background-position:center;
			background-repeat:no-repeat;
			background-attachment:fixed;}
			
/*不随窗口滚动的图片，我们一般设置给body，而不设置给其他元素
因为其他元素的图片固定，但元素不固定，还会随着页面动	*/	
			.aaa{width:200px;height:500px;
			background-color:#bfa;
			background-image:url(2.png);
			background-repeat:no-repeat;
			background-attachment:fixed;}
		</style>
	</head>
	<body>
		<div class="aaa"></div>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
		<p>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</p>
	</body>
</html>
